<?php
class OrderModel extends Model {
    // 支付完成后更新订单状态
    public function change_order_status($order_id, $notify_result)
    {
        $data = array();
        switch ($notify_result) {
            case ORDER_ACCEPTED://待发货订单
                $data = array(
                    'status'=>'1',
                    'pays_status'=>'1',
                );
                break;
            case ORDER_SHIPPED://已发货
                $data = array(
                    'status'=>'2',
                );
                break;
            case ORDER_FINISHED://交易完成
                $data = array(
                    'status'=>'3',
                );
                break;
            case ORDER_CANCLED://无效订单
                $data = array(
                    'status'=>'4',
                );
                break;
        }
        $this->wehre('id='.$order_id)->save($data);
    }
}
?>